package xnj.lazydog.btcontroller.ControlViews;

import java.io.Serializable;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;

import xnj.lazydog.btcontroller.ObjectFile.ObjectFile;

public class ItemProject implements Serializable {
    public static final int TYPE_PORTRAIT_VIEW = 0;
    public static final int TYPE_LANDSCAPE_VIEW = 1;


    public String name="";
    public String fileName="";
    //public String snapName = "";
    public int type=0;
    public long time=0;

    String filterFileName(String name)
    {
        /// \ : * " < > | ？
        name = name.replace("<","《");
        name = name.replace(">","《");
        name = name.replace("\\","！");
        name = name.replace(":","：");
        name = name.replace("*","※");
        name = name.replace("\"","”");
        name = name.replace("|","！");
        name = name.replace("/","の");
        name = name.replace("_","-");
        return name.replace("?","？");
    }


    public ItemProject(String name,int type)
    {
        this.name = name;
        this.type = type;
        this.time = ObjectFile.getLongTime();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
        String timeStr = simpleDateFormat.format(new Date(time));

        if(type==TYPE_LANDSCAPE_VIEW) {
            this.fileName = filterFileName(name) + "_H_"+ timeStr + ".pro";
        }else
        {
            this.fileName = filterFileName(name) + "_V_"+ timeStr + ".pro";
        }
        //this.fileName = (name)+"_"+timeStr +".pro";
        //this.snapName = fileName+".png";
    }

}
